home *** CD-ROM | disk | FTP | other *** search
/ Experimental BBS Explossion 3 / Experimental BBS Explossion III.iso / games / nhak_src.zip / PORTING < prev    next >
Text File  |  1993-03-16  |  6KB  |  145 lines

  1.   NetHack Porting Guidelines        v 3.0            89-05-05
  2.  
  3.  
  4.      1.0    Introduction
  5.  
  6.     This document goes through the steps required to port NetHack to a
  7. new machine.  The basic steps in porting the program are:
  8.  
  9.     1.  Get the code onto your machine.  The current directory setup
  10.         consists of one directory each for general and UNIX source
  11.         files (src), include files (include), auxiliary files (auxil),
  12.         files specific to the Amiga (amiga), and files specific to
  13.         other OSs like MSDOS and TOS (other).  A full list of the
  14.         files may be found in the top-level file "Files".
  15.  
  16.     2.  Modify the appropriate include files to customize NetHack to
  17.         your system.
  18.  
  19.     3.  Add, if required, a OS specific copy of "main.c", "tty.c" and
  20.         "unix.c".
  21.  
  22.     4.  Possibly add a OS specific library (see "msdos.c" and "tos.c"
  23.         as examples) and a OS specific "*conf.h" file (see unixconf.h,
  24.         pcconf.h, tosconf.h, etc. as examples).
  25.  
  26.     5.  Modify the top level makefile and the "src" makefile if required.
  27.         Then run an initial compile.  You are bound to get some errors.
  28.         You should be able to fix them in a fairly simple fashion.  If
  29.         things seem to be getting too complex, take a step back, and
  30.         possibly send me some mail.  I might be able to help.
  31.  
  32.     6.  Mail all of your fixes to me in a contextual form so that I can
  33.         easily integrate them into the code.
  34.  
  35.     One general rule of thumb exists.  Always add code.  Don't delete
  36. somebody else's code for yours - it won't work on his machine if you do.
  37. Always add your OS specific code inside #ifdef / #else / #endif constructs
  38. so that it will be able to be folded back into the original code easily.
  39.  
  40.  
  41.      2.0    Include Files
  42.  
  43.      2.1    config.h
  44.  
  45.     The file "config.h" is a master configuration file that determines
  46. the basic features of the game, as well as many of the security options.
  47. It is intended that end users configure the game by editing "config.h" and
  48. an appropriate "*conf.h" file, so any #defines for individual preferences
  49. should be added to those files.  OS-specific #defines that are not intended
  50. to be changed should also go in "*conf.h"; try to find the most appropriate
  51. place for other #defines.
  52.  
  53.     The following sections may require modification:
  54.  
  55.      -    Section 1:    OS selection.
  56.             You may have to put a #define for your OS here.
  57.             If your OS is yet another UNIX variant, put the
  58.             #define in unixconf.h instead.
  59.  
  60.      -    Section 2:    Global parameters and filenames.
  61.             You will have to customize the game to the
  62.             setup on your system.
  63.  
  64.      -    Section 3:    Type definitions.
  65.             These will have to be matched to your compiler.
  66.  
  67.      2.2    global.h
  68.  
  69.     This file defines things specific to NetHack that should not
  70. require modification by an end user.  For a new port, you may have to add
  71. automatic inclusion of another auxiliary config file (*conf.h) which you
  72. wrote for your system.
  73.  
  74.      2.3    extern.h
  75.  
  76.     If you create any new source modules or new functions in old modules,
  77. you must enter the names of the new external references (the functions defined
  78. there for external use) in this file.
  79.  
  80.      2.4    system.h
  81.  
  82.     This file contains references for all hooks into the OS (via the
  83. standard "C" libraries).  Depending on what your standard library looks like,
  84. you may have to put new entries into this file.
  85.  
  86.  
  87.      3.0    Source files
  88.  
  89.     The first step in getting the game up is to get the "makedefs"
  90. program running.  This program is used to create the appropriate configuration
  91. specific files for the game.
  92.  
  93.     Once "makedefs" has been built, the rest of the game can be compiled.
  94. You will probably have to create an OS specific module to handle things you
  95. want to use, like a mouse or a ram-disk.
  96.  
  97.     Please note that the dependancies in the "src" makefile for the
  98. "makedefs" program are deliberately wrong.  Don't try to fix them, you'll
  99. just create a dependancy loop as "makedefs" is considered to be dependant
  100. on some of the header files it creates when "make" searches back through
  101. other header files it includes.
  102.  
  103.      3.1    Makefile
  104.  
  105.     This distribution provides makefiles for several kinds of systems.
  106. There are joint makefiles for the various varieties of UNIX, makefiles for
  107. MSDOS, and a makefile for Amigas.  You may have to create a new makefile for
  108. your specific machine.  If possible, however, add to one of those provided.
  109.  
  110.      3.2    termcap.c
  111.  
  112.     If your system doesn't run off of a termcaps or terminfo database, you
  113. will have to put the appropriate terminal control strings into termcap.c.  This
  114. has already been done for DOS, and these mods can be used as an example.
  115.  
  116.      3.3    main.c
  117.  
  118.     You may need to create a new "main.c" module.  If you do, call it
  119. [OS]main.c where the [OS] is replaced with the name of the OS you are porting
  120. to.  This file contains the mainline module, which reads options from the
  121. command line and processes them.  It also contains the master game turn loop
  122. and various functions associated with game startup.
  123.  
  124.      3.4    tty.c
  125.  
  126.     You may need to create a new "tty.c" module.  If you do, call it
  127. [OS]tty.c where the [OS] is replaced with the name of the OS you are porting
  128. to.  This file contains the terminal/console interface routines, and is used
  129. for raw io, etc.  If your system isn't Unix, you will most certainly have to
  130. re-write it.
  131.  
  132.      3.5    unix.c
  133.  
  134.     You may need to create a new "unix.c" module.  If you do, call it
  135. [OS]unix.c where the [OS] is replaced with the name of the OS you are porting
  136. to.  This file contains some OS dependancies concerning time and filename
  137. creation.
  138.  
  139.  
  140.     The object of the NetHack development project is to get the game
  141. working on as many different types of hardware and under as many different
  142. operating systems as is practical.  Any assistance will be appreciated.
  143.  
  144.                         Mike Stephenson
  145.